The present invention relates to a system for cleaning and sterilizing a water flow. The present invention further relates to a method for cleaning and sterilizing the water flow. The system is used for cleaning water flowing from ballast tanks of a ship into the environment when the outflow of water must fulfil the requirements that are specified in the International Maritime Organisation (IMO) ballast water convention. According to this convention in the cleaned water flowing from the vessel the maximum number of organisms greater than 50 micron is 10 organisms per cubic meter, for organisms between 10 and 50 micron the maximum number is 10 organism per milliliter and the convention specifies maximum concentrations of viable microbes that are harmful for health.